#include <iostream>
#include <math.h>
using namespace std;

int main()
{	//daycode
	cout<<"Enter the code number for the day of the week for January 1 as follows:\n 0- Sun 1- Mon 2- Tue 3- Wed 4- Thur\ 5- Fri 6- Sat\n Enter the day code now (0-6):\n";
	int daycode;
	cin>>daycode;
	
	//leap t/f
	cout<<"Is the calendar for a leap year? (1 yes 0 no):\n";
	int leap;
	cin>>leap;

	cout<<"*** CALENDAR ***\n";
	int month=0;
	int numdays=31;
	int count=0;
	
	while (month<12){
	switch(month){
	case 0:
	numdays=31;
	cout<<"January\nSun Mon Tue Wed Thu Fri Sat\n";
	break;
	
	case 1: 
	numdays=28+leap;
	cout<<"February\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 2: 
	numdays=31;
	cout<<"March\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 3: 
	numdays=30;
	cout<<"April\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 4: 
	numdays=31;
	cout<<"May\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 5: 
	numdays=30;
	cout<<"June\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 6: 
	numdays=31;
	cout<<"July\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 7: 
	numdays=31;
	cout<<"August\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 8: 
	numdays=30;
	cout<<"September\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 9: 
	numdays=31;
	cout<<"October\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 10: 
	numdays=30;
	cout<<"November\nSun Mon Tue Wed Thu Fri Sat\n";
	break;

	case 11: 
	numdays=31;
	cout<<"December\nSun Mon Tue Wed Thu Fri Sat\n";
	break;
	}
	month++;
	

	//int for odd or even number of days 1 odd 0 even
	//int evenodd=1;
	//BOOL for controlling white space
	//bool w=true;
	//loop for months, starting with January
	//for(int i=0; i<12; i++){
		
			//utilize int daycode	
			int j=0;
			while(j<daycode){
				cout<<"    ";
				count++;
				j++;
				
			}
				for(int i=1; i<=numdays; i++){
					

					if(i<10){
					cout<<"  "<<i<<" ";
					count++;
					}
					else{
						cout<<" "<<i<<" ";
						count++;
					}
					if(count==7)
					{cout<<"\n"; count=0;}
					
				}
				cout<<"\n";
				cout<<"\n";
				daycode=0;
		

	}	
	
	system("pause");
	return 0;
}

